@extends('layout.index')
@section('title','后台分类修改')

@section('content')
<div class="row">
    <div class="col-lg-8">
        <h1 class="page-header">分类修改</h1>
    </div>
    <!-- /.col-lg-12 -->
</div>

<div class="row">
	
    <div class="col-lg-8 ">
    	<div class="panel panel-default">						<div class="panel-heading">	
    			

                @if (count($errors) > 0)
				    <div class="alert alert-danger">
				        <ul>
				            @foreach ($errors->all() as $error)
				                <li>{{ $error }}</li>
				            @endforeach
				        </ul>
				    </div>
				@endif
    		</div>		

    		<div class="row">
    		<div class="col-lg-2"></div>
    			  <div class="col-lg-8 ">
    			<br>
			<form role="form" action="{{url('/admin/cate/update')}}" method="post" enctype="multipart/form-data">
                @if (!empty($cate->test))
                    <div class="form-group">
                    <label>分类列表</label>
                    <select name="pid" class="form-control">
                        <option value="0">顶级分类</option>
                    @foreach($cates as $k=>$v)
                        <option value="{{$v->id}}" 
                        @if($cate->pid == $v->id)
                        selected
                        @endif
                        >{{$v->name}}</option>
                    @endforeach
                    </select>
                    </div>
                @endif
				
			    <div class="form-group">
			        <label>分类名</label>
			        <input type="text" value="{{$cate->name}}" name="name" value="{{old('username')}}" class="form-control">
			    </div>
                <!-- 隐藏域传修改id -->
                <input type="hidden" name="id" value="{{$cate->id}}">					    
			    <!-- token隐藏域 -->
			    {{csrf_field()}}
			    <button class="btn btn-primary " type="submit">修改</button>
			    <button class="btn btn-warning " type="reset">重置</button>
			</form>
			</div>
			</div>
			<br>
	</div>
   </div>
</div>
@endsection